<template>
    <div id="login">
        <div class="logo">
            <img src="../assets/gotion_logo1.png">
            <p class="logocharacters">远程监控系统</p>
        </div>
        <div class="middle">
            <div class="middlearea">
                <div class="form">
                    <div class="hello">Hello！</div>
                    <div class="title">欢迎登陆远程监控系统！</div>
                    <div class="loginform">
                        <el-input prefix-icon="el-icon-user" type="text" v-model="loginform.userName" placeholder="请输入账号"></el-input>
                        <el-input prefix-icon="el-icon-lock" type="password" v-model="loginform.passWord" placeholder="请输入密码"></el-input>
                        <el-button type="primary" @click="onSubmit">登录</el-button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<style scoped>
#login{
    width: 100%;
    height: 100%;
    /* background: url(http://10.34.195.2:13308/gif/bk4-f3ab68c5.gif) no-repeat center center; */
    background: url(../assets/login.gif) no-repeat center center;
    background-size: cover;
    background-position: center;
    background-blend-mode: multiply;
    position: fixed;
    /* z-index: -1; */
    top: 0;
    left: 0;
    background-color: #00000080;
    color: #fff;
    font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
}
.logo{
    position: absolute;
    left: 2.5rem;
    top: 2.5rem;
    z-index: 1;
    display: flex;
    align-items: center;
    height: 7.5rem;
}
img{
    width: 6.25rem;
    height: 6.25rem;
}
.logocharacters{
    font-size: 2.5rem;
    font-weight: 600;
}
.middle{
    display: flex;
    flex-flow: row wrap;
    height: 100%;
    justify-content: center;
    align-items: center;
}
.middlearea{
    width: 43.75rem;
    height: 41.875rem;
    /* backdrop-filter: blur(.625rem); */
    display: flex;
    justify-content: center;
    align-items: center;
    /* display: block;
    flex: 0 0 37.5%;
    max-width: 37.5%; */
}
.form{
    box-sizing: border-box;
    margin: 0 auto;
    width: 37.5rem;
    height: 35rem;
    padding: 3.875rem 4.5rem;
    background: rgba(255,255,255,.06);
    background-size: 100% 100%;
    border-image: linear-gradient(135deg,rgba(39,136,221,.5),rgba(255,255,255,.1)) 1 1;
    backdrop-filter: blur(.375rem);
    border-radius: .625rem;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: start;
}
.loginform{
    width: 100%;
    height: 16.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: start;
}
.el-input{
    width: 100%;
    height: 3.75rem;
    padding: 0;
    box-sizing: border-box;
    border: 0;
    border-radius: .25rem;
    
}
::v-deep .el-input__inner {
    width: 100%;
    line-height: 3.75rem;
    height: 3.75rem;
    background: black;
    color: white;
    font-size: 1.125rem;
}
.el-button{
    width: 100%;
    height: 3.75rem;
}
</style>
<script>
import axios from 'axios';
export default {
    data() {
        return {
            loginform: {
                userName:'',
                passWord:'',
            },
            flag:undefined,
            errMessage:''
        }
    },
    methods: {
        onSubmit() {
            this.checkLoginResult()
            // this.$router.push('/monitor')
        },
        checkLoginResult(){
            axios.post('/myapp/monitor/register',this.loginform).then(res=>{
                console.log('返回登录信息：',res.data)
                this.flag=res.data.data.isFlag
                this.errMessage=res.data.message
                if(this.flag==true){
                    this.$router.push('/monitor')
                    this.$store.dispatch('setuserName',this.loginform.userName)
                    this.$store.dispatch('setPass',this.loginform.passWord)
                }
                else{
                    this.$message.error(this.errMessage)
                }
            })
        },
    }
}
</script>